Micron Document
🎖️GitЯра🎖️


Displaying Raw • View renderedDownload

core/database/README.md bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 2.67 KB

Tc9d1d9# `:core:database`

This module provides the local Room database persistence layer for the application using Room Kotlin Multiplatform (KMP).

Tc9d1d9## Key Components

Tff7b72- **`MeshtasticDatabase`**: The main Room database class, defined in Ta5d6ff`commonMain`.
Tff7b72- **DAOs (Data Access Objects)**:
Tff7b72- Ta5d6ff`NodeInfoDao`: Manages storage and retrieval of node information (Ta5d6ff`NodeEntity`). Contains critical logic for handling Public Key Conflict (PKC) resolution and preventing identity wiping attacks.
Tff7b72- Ta5d6ff`PacketDao`: Handles storage of mesh packets, including text messages, waypoints, and reactions.
Tff7b72- **Entities**:
Tff7b72- Ta5d6ff`NodeEntity`: Represents a node on the mesh.
Tff7b72- Ta5d6ff`Packet`: Represents a stored packet.
Tff7b72- Ta5d6ff`ReactionEntity`: Represents emoji reactions to packets.

Tc9d1d9## Security Considerations

Tc9d1d9### Public Key Conflict (PKC) Handling
The Ta5d6ff`NodeInfoDao` implements specific logic to protect against impersonation and "wipe" attacks:
Tff7b72- **Wipe Protection**: Receiving an Ta5d6ff`is_licensed=true` packet (which normally clears the public key for compliance) will **not** clear an existing valid public key if one is already known. This prevents attackers from sending fake licensed packets to wipe keys from the DB.
Tff7b72- **Conflict Detection**: If a new key arrives for an existing node ID that conflicts with a known valid key, the key is set to Ta5d6ff`ERROR_BYTE_STRING` to flag the potential impersonation.


Tc9d1d9## Dependency Graph

<!--region graph-->
Ta5d6ff```Ta5d6ffmermaid
Ta5d6ffgraph TB
:core:database[database]:::kmp-library
:core:database --> :core:common
:core:database --> :core:model
:core:database -.-> :core:di
:core:database -.-> :core:resources
:core:database -.-> :core:testing

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;

Ta5d6ff```
<!--endregion-->

Served by rngit 1.5.0 - Generated in 0.05s